*------------------------------------------------------------------------------*
* Family history - Dinas, Fouka, Schläpfer - JoP
*------------------------------------------------------------------------------*

*------------------------------------------------------------------------------*
* Table D6
*------------------------------------------------------------------------------*



*------------------------------------------------------------------------------*
* Greece
*------------------------------------------------------------------------------*

use greece, clear

gen asiaminorT=asiaminor*T
local treatment T
local controls female i.age i.edu i.occupation i.income i.nomos
estimates clear
 
foreach x in index_behavioralst index_bin_allst pc_all_blite2st {
	reg `x' T asiaminor asiaminorT, cl(municipality)
	eststo mg_`x'
	reg `x' T asiaminor asiaminorT `controls', cl(municipality)
	eststo mg_`x'_c
}

gen desc_T=asiaminor*T
gen nonasia_T=(1-asiaminor)*T

foreach x in index_behavioralst index_bin_allst pc_all_blite2st {
	reg `x' asiaminor nonasia_T desc_T, cl(municipality)
	eststo eg_`x'
	reg `x' asiaminor nonasia_T desc_T  `controls', cl(municipality)
	eststo eg_`x'_c
}



*------------------------------------------------------------------------------*
* Germany
*------------------------------------------------------------------------------*

use germany, clear

rename t1 T

local controls i.sex i.state i.age i.F4 i.F13

gen expelleeT=T*expellee
foreach x in avg_att pc_att_lite {
	reg `x' T expellee expelleeT, cl(GKZ)
	eststo md_`x'
	reg `x' T expellee expelleeT `controls' , cl(GKZ)
	eststo md_`x'_c
}

gen desc_T=expellee*T
gen nonexpellee_T=(1-expellee)*T

foreach x in avg_att pc_att_lite {
	reg `x' expellee nonexpellee_T desc_T, cl(GKZ)
	eststo ed_`x'
	reg `x' expellee nonexpellee_T desc_T `controls', cl(GKZ)
	eststo ed_`x'_c
}
		
*------------------------------------------------------------------------------*
* Combine
*------------------------------------------------------------------------------*

esttab mg* md* using Table_D6.html, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2)  ///
		keep(T asiaminor asiaminorT expellee expelleeT)
		
esttab eg* ed* using Table_D6_addlines.html, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2)  ///
		keep(desc_T)
